package com.zzyl.controller.customer;

import com.zzyl.base.PageBean;
import com.zzyl.base.ResponseResult;
import com.zzyl.service.CustomeOrderService;
import com.zzyl.vo.NursingProjectVo;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;

import javax.validation.constraints.Min;

@Api(tags = "客户订单管理")
@RestController
@RequestMapping("/customer/orders")
@Slf4j
@RequiredArgsConstructor
public class CustomerOrderController {
    private final CustomeOrderService customerLoginService;
    /*
    * 传入四个值name
    * pageNum
    * pageSize
    * status
    * @Validated校验
    * */
        @GetMapping("/project/page")
        @ApiOperation("分页查询护理项目列表")
        @Validated
    public ResponseResult<?> page(@RequestParam(required = false) String name, @Min(1) Integer pageNum, @Min(1) Integer pageSize, @RequestParam(required = false) Integer status){
            PageBean<NursingProjectVo> result = customerLoginService.page(name, pageNum, pageSize, status);
            return ResponseResult.success(result);
        }
    @GetMapping("/project/{id}")
    @ApiOperation("分页查询护理项目列表")
    public ResponseResult<?> getIdList(@PathVariable Integer id){
        NursingProjectVo result = customerLoginService.getIdList(id);
        return ResponseResult.success(result);
    }
}




